home *** CD-ROM | disk | FTP | other *** search
/ PC Elektro 3 / PC-Elektro-3-cd1.bin / KBan 2.0 / KBANSRC.LZH / SRC / PROG / RECORD.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-18  |  581 b   |  35 lines

  1. /*
  2.  * a recording routine
  3.  * Copyright (C) 1995-1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
  4.  */
  5.  
  6. #include "stdafx.h"
  7.  
  8. #include <stdio.h>
  9.  
  10. #include "record.h"
  11.  
  12. static int start = 0;
  13.  
  14. RECORD_STREAM rec;
  15.  
  16. #define RECORD_FNAME "record.txt"
  17.  
  18. void record_mes(const char* mes)
  19. {
  20.   FILE* fp = fopen(RECORD_FNAME, (start == 0) ? "w" : "a");
  21.   if(fp == NULL) {
  22.     fprintf(stderr, "\a\a\a");
  23.     goto failed;
  24.   }
  25.   if(start == 0) {
  26.     fprintf(fp, "Start\n");
  27.     start = 1;
  28.   }
  29.   fprintf(fp, "%s", mes);
  30.   fflush(fp);
  31.   fclose(fp);
  32. failed:
  33.   return;
  34. }
  35.